<?php

/**
 * This is the DbTable class for the readings table.
 */
class Model_DbTable_Room extends Zend_Db_Table_Abstract
{
    /** Table name */
    protected $_name    = 'ac2_room';    
    /**
     * The primary key column or columns.
     * A compound key should be declared as an array.
     * You may declare a single-column primary key
     * as a string.
     *
     * @var mixed
     */
    protected $_primary = 'room_id';

    protected $_referenceMap    = array(
        'RoomZone' => array(
            'columns'           => array('room_id'),
            'refTableClass'     => 'Model_DbTable_RoomZone',
            'refColumns'        => array('room_id'),
            'onDelete'          => self::CASCADE,            
        ),
      'Setpoint' => array(
          'columns'           => array('room_id'),
          'refTableClass'     => 'Model_DbTable_Setpoint',
          'refColumns'        => array('room_id'),
          'onDelete'          => self::CASCADE,            
      )
    );    

    /**
     * Insert new row
     *
     * @param  array $data 
     * @return int
     */
    public function insert(array $data)
    {
        return parent::insert($data);
    }

    /**
     * Override updating
     *
     * Do not allow updating of temperature readings
     * 
     * @param  array $data 
     * @param  mixed $where 
     * @return void
     * @throws Exception
     */
/*
    public function update(array $data, $where)
    {
        throw new Exception('Cannot update readings');
    }  
*/
}
